runOnCommit

Add a Runnable to this transaction that will be run after this transaction has been committed. If fragment transactions are optimized this may be after other subsequent fragment operations have also taken place, or operations in this transaction may have been optimized out due to the presence of a subsequent fragment transaction in the batch.

If a transaction is committed using commitAllowingStateLoss this runnable may be executed when the FragmentManager is in a state where new transactions may not be committed without allowing state loss.

runOnCommit may not be used with transactions added to the back stack as Runnables cannot be persisted with back stack state. IllegalStateException will be thrown if addToBackStack has been previously called for this transaction or if it is called after a call to runOnCommit.

Return

this FragmentTransaction

Parameters

runnable

Runnable to add

Throws